Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions oss-licenses-plugin/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
apply plugin: 'groovy'
apply plugin: 'java'
apply plugin: 'java-gradle-plugin'

dependencies {
implementation gradleApi()
Expand Down Expand Up @@ -43,3 +44,7 @@ task packageFiles(type: Zip, dependsOn: 'uploadArchives') {
def groupDir = rootProject.group.replaceAll('\\.', '/')
from("../repo/$groupDir/$rootProject.name/$rootProject.version/")
}

validateTaskProperties {
failOnWarning = true
}
Binary file modified oss-licenses-plugin/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
22 changes: 19 additions & 3 deletions oss-licenses-plugin/gradlew
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
#!/usr/bin/env sh

#
# Copyright 2015 the original author or authors.
#
# 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
#
# https://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.
#

##############################################################################
##
## Gradle start up script for UN*X
Expand Down Expand Up @@ -28,7 +44,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
Expand Down Expand Up @@ -109,8 +125,8 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi

# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
Expand Down
18 changes: 17 additions & 1 deletion oss-licenses-plugin/gradlew.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
Expand All @@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import org.gradle.api.artifacts.ConfigurationContainer
import org.gradle.api.artifacts.ResolveException
import org.gradle.api.artifacts.ResolvedArtifact
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.OutputDirectory
import org.gradle.api.tasks.OutputFile
import org.gradle.api.tasks.TaskAction

Expand All @@ -51,17 +50,13 @@ class DependencyTask extends DefaultTask {
"api"]

@Input
public ConfigurationContainer configurations

@OutputDirectory
public File outputDir
final ConfigurationContainer configurations = project.configurations {}

@OutputFile
public File outputFile
File outputFile

@TaskAction
void action() {
initOutput()
updateDependencyArtifacts()

if (outputFile.exists() && checkArtifactSet(outputFile)) {
Expand Down Expand Up @@ -186,10 +181,4 @@ class DependencyTask extends DefaultTask {
return null
}
}

private void initOutput() {
if (!outputDir.exists()) {
outputDir.mkdirs()
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ import org.gradle.api.DefaultTask
import org.gradle.api.artifacts.component.ModuleComponentIdentifier
import org.gradle.api.artifacts.result.ResolvedArtifactResult
import org.gradle.api.internal.artifacts.DefaultModuleIdentifier
import org.gradle.api.tasks.CacheableTask
import org.gradle.api.tasks.InputFile
import org.gradle.api.tasks.OutputDirectory
import org.gradle.api.tasks.OutputFile
import org.gradle.api.tasks.PathSensitive
import org.gradle.api.tasks.PathSensitivity
import org.gradle.api.tasks.TaskAction
import org.gradle.internal.component.external.model.DefaultModuleComponentIdentifier
import org.gradle.maven.MavenModule
Expand All @@ -38,6 +40,7 @@ import java.util.zip.ZipFile
* file generated by DependencyTask, and then generate the third_party_licenses
* and third_party_license_metadata file.
*/
@CacheableTask
class LicensesTask extends DefaultTask {
private static final String UTF_8 = "UTF-8"
private static final byte[] LINE_SEPARATOR = System
Expand All @@ -57,20 +60,17 @@ class LicensesTask extends DefaultTask {
protected Map<String, String> licensesMap = [:]

@InputFile
public File dependenciesJson

@OutputDirectory
public File outputDir
@PathSensitive(PathSensitivity.NONE)
File dependenciesJson

@OutputFile
public File licenses
File licenses

@OutputFile
public File licensesMetadata
File licensesMetadata

@TaskAction
void action() {
initOutputDir()
initLicenseFile()
initLicensesMetadata()

Expand Down Expand Up @@ -105,12 +105,6 @@ class LicensesTask extends DefaultTask {
writeMetadata()
}

protected void initOutputDir() {
if (!outputDir.exists()) {
outputDir.mkdirs()
}
}

protected void initLicenseFile() {
if (licenses == null) {
logger.error("License file is undefined")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ class OssLicensesPlugin implements Plugin<Project> {
def dependencyOutput = new File(project.buildDir,
"generated/third_party_licenses")
def generatedJson = new File(dependencyOutput, "dependencies.json")
getDependencies.configurations = project.getConfigurations()
getDependencies.outputDir = dependencyOutput
getDependencies.outputFile = generatedJson

def resourceOutput = new File(dependencyOutput, "/res")
Expand All @@ -39,14 +37,9 @@ class OssLicensesPlugin implements Plugin<Project> {
def licenseTask = project.tasks.create("generateLicenses", LicensesTask)

licenseTask.dependenciesJson = generatedJson
licenseTask.outputDir = outputDir
licenseTask.licenses = licensesFile
licenseTask.licensesMetadata = licensesMetadataFile

licenseTask.inputs.file(generatedJson)
licenseTask.outputs.dir(outputDir)
licenseTask.outputs.files(licensesFile, licensesMetadataFile)

licenseTask.dependsOn(getDependencies)

project.android.applicationVariants.all { BaseVariant variant ->
Expand Down Expand Up @@ -76,15 +69,5 @@ class OssLicensesPlugin implements Plugin<Project> {
variant.registerResGeneratingTask(licenseTask, resourceOutput)
}
}

def cleanupTask = project.tasks.create("licensesCleanUp",
LicensesCleanUpTask)
cleanupTask.dependencyFile = generatedJson
cleanupTask.dependencyDir = dependencyOutput
cleanupTask.licensesFile = licensesFile
cleanupTask.metadataFile = licensesMetadataFile
cleanupTask.licensesDir = outputDir

project.tasks.findByName("clean").dependsOn(cleanupTask)
}
}

This file was deleted.

Loading