Skip to content

Ywmei/windows build #3801

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 17, 2022
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

package com.google.firebase.gradle.plugins.license;

import java.io.File;
import java.io.Serializable;
import java.net.URI;
import java.util.ArrayList;
Expand All @@ -27,18 +28,25 @@ public class ThirdPartyLicensesExtension {
* supported
*/
public void add(String name, String... licenseUris) {
customLicenses.add(new CustomLicense(name, licenseUris));
customLicenses.add(CustomLicense.buildFromStrings(name, licenseUris));
}

static class CustomLicense implements Serializable {
final String name;
final List<URI> licenseUris = new ArrayList<>();
final List<URI> licenseUris;

CustomLicense(String name, String[] licenseUris) {
CustomLicense(String name, List<URI> licenseUris) {
this.name = name;
this.licenseUris = licenseUris;
}

static CustomLicense buildFromStrings(String name, String[] licenseUris) {
List<URI> uris = new ArrayList<>();
for (String s : licenseUris) {
this.licenseUris.add(URI.create(s));
File file = new File(s);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

afaicr we used to allow specifying http(s) urls in thirdPartyLicenses{}, looks like it will no longer work.

I think it's fine since it has never been used, but wanted to call it out for future reference.

uris.add(file.toURI());
}
return new CustomLicense(name, uris);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import com.google.common.collect.ImmutableMap;
import com.google.firebase.gradle.plugins.FirebaseLibraryExtension;
import digital.wup.android_maven_publish.AndroidMavenPublishPlugin;
import java.net.URI;
import java.io.File;
import java.util.Arrays;
import java.util.Set;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -118,11 +118,9 @@ public void apply(Project project) {
repos ->
repos.maven(
repo -> {
repo.setUrl(
URI.create(
"file://"
+ sub.getRootProject().getBuildDir()
+ "/m2repository"));
String s = sub.getRootProject().getBuildDir() + "/m2repository";
File file = new File(s);
repo.setUrl(file.toURI());
repo.setName("BuildDir");
}));
publishing.publications(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class LicenseResolverPluginTests {
android.compileSdkVersion = 26

thirdPartyLicenses {
add 'customLib', "file:///${File("non_existent_path.txt").absolutePath}"
add 'customLib', "${File("non_existent_path.txt").absolutePath}"
}
""")

Expand Down Expand Up @@ -141,7 +141,7 @@ class LicenseResolverPluginTests {
}

thirdPartyLicenses {
add 'customLib1', "file:///${File("src/test/fixtures/license.txt").absolutePath}"
add 'customLib1', "${File("src/test/fixtures/license.txt").absolutePath}"
}
"""
}
Expand Down
2 changes: 1 addition & 1 deletion firebase-crashlytics-ndk/firebase-crashlytics-ndk.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def fixTrampolineFilenames(variantBaseName) {
}

thirdPartyLicenses {
add 'Crashpad', "file://${rootDir}/third_party/licenses/apache-2.0.txt"
add 'Crashpad', "${rootDir}/third_party/licenses/apache-2.0.txt"
}

dependencies {
Expand Down
2 changes: 1 addition & 1 deletion firebase-crashlytics/firebase-crashlytics.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ android {
}

thirdPartyLicenses {
add 'Tape', "file://${projectDir}/third_party_licenses/tape/LICENSE"
add 'Tape', "${projectDir}/third_party_licenses/tape/LICENSE"
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ android {


thirdPartyLicenses {
add 'Dagger', "file://${rootDir}/third_party/licenses/apache-2.0.txt"
add 'Dagger', "${rootDir}/third_party/licenses/apache-2.0.txt"
}

dependencies {
Expand Down
2 changes: 1 addition & 1 deletion firebase-inappmessaging/firebase-inappmessaging.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ configurations.all {


thirdPartyLicenses {
add 'Dagger', "file://${rootDir}/third_party/licenses/apache-2.0.txt"
add 'Dagger', "${rootDir}/third_party/licenses/apache-2.0.txt"
}

dependencies {
Expand Down
2 changes: 1 addition & 1 deletion transport/transport-runtime/transport-runtime.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ android {
}

thirdPartyLicenses {
add 'Dagger', "file://${rootDir}/third_party/licenses/apache-2.0.txt"
add 'Dagger', "${rootDir}/third_party/licenses/apache-2.0.txt"
}

dependencies {
Expand Down