-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support android gradle build tools 2.3.3 and lower with gradle 4.x
- Loading branch information
Showing
9 changed files
with
289 additions
and
283 deletions.
There are no files selected for viewing
110 changes: 0 additions & 110 deletions
110
plugin/src/main/groovy/digital/wup/android_maven_publish/AndroidLibrary.groovy
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
plugin/src/main/groovy/digital/wup/android_maven_publish/DefaultPublishConfiguration.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Copyright 2017 W.UP Ltd. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package digital.wup.android_maven_publish | ||
|
||
import com.android.build.gradle.LibraryExtension | ||
import org.gradle.api.Project | ||
import org.gradle.api.artifacts.Dependency | ||
import org.gradle.api.artifacts.PublishArtifact | ||
|
||
class DefaultPublishConfiguration implements PublishConfiguration { | ||
|
||
private Project project | ||
|
||
DefaultPublishConfiguration(Project project) { | ||
this.project = project | ||
} | ||
|
||
@Override | ||
String getName() { | ||
return 'android' | ||
} | ||
|
||
@Override | ||
String getPublishConfig() { | ||
def android = project.extensions.getByType(LibraryExtension) | ||
return android.defaultPublishConfig | ||
} | ||
|
||
@Override | ||
Set<PublishArtifact> getArtifacts() { | ||
def configurations = project.configurations | ||
def artifacts = configurations.getByName(Dependency.ARCHIVES_CONFIGURATION).allArtifacts.toSet() | ||
|
||
// Fix duplicated artifact when use android gradle build tools 2.3.3 or lower | ||
return artifacts.unique(false, new Comparator<PublishArtifact>() { | ||
@Override | ||
int compare(PublishArtifact a1, PublishArtifact a2) { | ||
"${a1.file.path}${a1.type}${a1.classifier}" <=> "${a2.file.path}${a2.type}${a2.classifier}" | ||
} | ||
}) | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
plugin/src/main/groovy/digital/wup/android_maven_publish/PublishConfiguration.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright 2017 W.UP Ltd. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package digital.wup.android_maven_publish | ||
|
||
import org.gradle.api.artifacts.PublishArtifact | ||
|
||
interface PublishConfiguration { | ||
|
||
/** | ||
* Component name for publish | ||
* | ||
* @return Name of component | ||
*/ | ||
String getName() | ||
|
||
/** | ||
* Publish configuration name or variant name | ||
* @return | ||
*/ | ||
String getPublishConfig() | ||
|
||
/** | ||
* Publish artifacts | ||
* | ||
* @return Artifacts | ||
*/ | ||
Set<PublishArtifact> getArtifacts() | ||
} |
Oops, something went wrong.