Skip to content

Commit ba5a311

Browse files
committed
Initial import
0 parents  commit ba5a311

File tree

176 files changed

+4704
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

176 files changed

+4704
-0
lines changed

.gitattributes

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
* text=auto
2+
*.java text
3+
*.properties text
4+
*.css text
5+
*.html text
6+
*.xhtml text
7+
*.dtd text
8+
*.ent text
9+
*.txt text
10+
*.sh text
11+
*.xml text
12+
*.bin binary
13+
*.png binary

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
*~
2+
.classpath
3+
.project
4+
.settings
5+
*/bin/
6+
**/build/
7+
/.idea
8+
/.gradle
9+
/buildSrc/.gradle

CONTRIBUTING.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# Contributing to Web-APIs
2+
3+
You can contribute to this project by raising issues and/or sending `git` pull
4+
requests.
5+
6+
<br/>
7+
8+
## Report issues
9+
10+
If you find any issue with the software or want to ask for an enhancement, use
11+
the Github's [issue tracker](https://github.com/css4j/web-apis/issues).
12+
13+
<br/>
14+
15+
## Pull requests
16+
17+
To contribute code to this project it is recommended to open an issue first,
18+
explaining the rationale for the changes that you want to implement. Then, in
19+
the title of the pull request (PR) you can include a reference like "fixes #NN"
20+
where NN is the issue number. And it is generally a good idea to base your PR on
21+
a branch that was named after the issue; for example your branch could be named
22+
`issue-14`.
23+
24+
A PR should only try to fix a single issue, unless it fixes two or more issues
25+
that are very related or effectively the same. And if a commit has two or more
26+
different purposes, it is often better to split it in multiple commits; tools
27+
like the _Git GUI_ are particularly useful for that.
28+
29+
<br/>
30+
31+
### Commit messages
32+
33+
It is recommended that commit messages (or at least the message for the main
34+
commit) start with a prefix related to the API being affected. For example:
35+
```
36+
smil: change return type of function. Fixes #2.
37+
```
38+
If the commit has a wider scope than a single area, you do not need to include
39+
any prefix, for example:
40+
```
41+
Add .gitattributes file.
42+
```
43+
The commit should focus on a specific task, and its descriptive message should
44+
tell accurately what the commit does. For example, do not mix bug fixes with
45+
arbitrary clean-ups, unless the clean-up is part of the fix.
46+
47+
Although it is acceptable to include a small, unrelated code formatting fix
48+
inside a bug-fixing commit (like a small indentation fix in the same file), if
49+
the commit contains several formatting changes they should be split to a
50+
different commit. That eases the task of future code reviewers.
51+
52+
<br/>
53+
54+
### Code style
55+
56+
The code style could be summarized by the following points:
57+
58+
- Indent by tabs, not spaces. The automated formatting provided by the Eclipse
59+
IDE is often used.
60+
- Avoid trailing whitespace except for empty lines in Javadoc comments.
61+
- `if`-`else` blocks should always use curly braces, even if a single line of
62+
code is involved.
63+
- Long, descriptive variable names are preferred.
64+
- Add comments to explain what the code is trying to do, but avoiding useless
65+
prose that just mimics the code, like _"check if foo is larger than 1"_ as a
66+
comment to `if (foo > 1)`.
67+
- Public and protected methods must have documentation comments.
68+
- Code readability should not be sacrificed for compactness, unless there are
69+
obvious gains and the trade-off can be justified. For example, `i++; foo(i);` is
70+
preferable to `foo(++i);` except in conditional expressions.
71+
- Classes and methods should have the minimum visibility that they require.
72+
A method should not have `protected` visibility when being package-visible could
73+
be enough, unless subclasses in other packages would naturally extend it. For
74+
complex package-level or inner classes, it is acceptable to have `protected`
75+
methods as a mean to document which ones are intended to be overridden by other
76+
classes. (In that case, protected methods do not appear in the Javadocs and
77+
therefore are not part of the API)
78+
79+
<br/>
80+
81+
### Licensing
82+
83+
All your contributions are submitted according to the license of this project,
84+
see the LICENSE file for more information.
85+
86+
## Distribution
87+
88+
This project [is not being submitted to the Maven Central repository](https://groups.google.com/g/css4j/c/op5jIoINb3M/m/IiiN-LfkDAAJ)
89+
and this is something known to deter some contributors, thus being a relevant
90+
information to cover here.
91+
92+
However, the project distributes its artifacts through the css4j Maven
93+
repository, as explained in the [README](README.md) (see 'Usage from a Gradle
94+
project'). Please use that repository **only** for the artifact groups that it
95+
supplies.

LICENSE.txt

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
Copyright (c) 2010 World Wide Web Consortium, (Massachusetts Institute of
2+
Technology, European Research Consortium for Informatics and Mathematics, Keio
3+
University). All Rights Reserved.
4+
5+
This work is being provided by the copyright holders under the following
6+
license:
7+
8+
9+
License
10+
=======
11+
By obtaining, using and/or copying this work, you (the licensee) agree that you
12+
have read, understood, and will comply with the following terms and conditions.
13+
14+
Permission to copy, modify, and distribute this software and its documentation,
15+
with or without modification, for any purpose and without fee or royalty is
16+
hereby granted, provided that you include the following on ALL copies of the
17+
software and documentation or portions thereof, including modifications:
18+
19+
The full text of this NOTICE in a location viewable to users of the
20+
redistributed or derivative work.
21+
22+
Any pre-existing intellectual property disclaimers, notices, or terms and
23+
conditions. If none exist, the W3C Software Short Notice should be included
24+
(hypertext is preferred, text is permitted) within the body of any
25+
redistributed or derivative code.
26+
27+
Notice of any changes or modifications to the files, including the date changes
28+
were made. (We recommend you provide URIs to the location from which the code is
29+
derived.)
30+
31+
32+
Disclaimers
33+
===========
34+
THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE
35+
NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
36+
TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT
37+
THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY
38+
PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
39+
40+
COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR
41+
CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION.
42+
43+
The name and trademarks of copyright holders may NOT be used in advertising or
44+
publicity pertaining to the software without specific, written prior permission.
45+
Title to copyright in this software and any associated documentation will at all
46+
times remain with copyright holders.

README.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Web APIs
2+
3+
This repository contains Java bindings of Web APIs that are used by Carte/CSS4J
4+
projects.
5+
6+
<br/>
7+
8+
## Building from source
9+
10+
### Requirements
11+
12+
To build `web-apis` you need the following software installed:
13+
14+
- The [Git version control system](https://git-scm.com/downloads) is required to
15+
obtain the sources. Any recent version should suffice.
16+
- Java 11 or later. You can install it from your favourite package manager or by
17+
downloading from [Adoptium](https://adoptium.net/).
18+
19+
<br/>
20+
21+
### Building with Gradle
22+
23+
Execute the build script with `gradlew build` to build. For example:
24+
25+
```shell
26+
git clone https://github.com/css4j/web-apis.git
27+
cd web-apis
28+
./gradlew build
29+
```
30+
or just `gradlew build` (without the `./`) on a Windows command prompt.
31+
32+
<br/>
33+
34+
### Deploying to a Maven repository
35+
36+
Use:
37+
- `gradlew build publishToMavenLocal` to install in your local Maven repository.
38+
- `gradlew publish` to deploy to a (generally remote) Maven repository.
39+
40+
Before deploying to a remote Maven repository, please read the
41+
`publishing.repositories.maven` block of
42+
[web-apis.java-conventions.gradle](https://github.com/css4j/web-apis/blob/master/buildSrc/src/main/groovy/web-apis.java-conventions.gradle)
43+
to learn which properties you need to set (like `mavenReleaseRepoUrl`or
44+
`mavenRepoUsername`), either at the [command line](https://docs.gradle.org/current/userguide/build_environment.html#sec:project_properties)
45+
(`-P` option) or your `GRADLE_USER_HOME/gradle.properties` file.
46+
47+
<br/>
48+
49+
## Usage from a Gradle project
50+
51+
If your Gradle project depends on any of the web-apis modules, you can use this
52+
project's own Maven repository in a `repositories` section of your build file:
53+
```groovy
54+
repositories {
55+
maven {
56+
url "https://css4j.github.io/maven/"
57+
mavenContent {
58+
releasesOnly()
59+
}
60+
content {
61+
includeGroup 'io.sf.carte'
62+
}
63+
}
64+
}
65+
```
66+
please use that repository **only** for the artifact groups that it supplies.
67+
68+
Then, in your `build.gradle` file you can list the dependencies, for example:
69+
```groovy
70+
dependencies {
71+
api "io.sf.carte:smil-api:1.0"
72+
api "io.sf.carte:svgom-api:1.0"
73+
}
74+
```
75+
76+
<br/>
77+
78+
## Licensing
79+
80+
The source files and derived works are available under the "W3C Software and
81+
Document Notice and License". Please read the [LICENSE.txt](LICENSE.txt) file
82+
for details.

buildSrc/build.gradle

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
plugins {
2+
// Support convention plugins written in Groovy.
3+
id 'groovy-gradle-plugin'
4+
}
5+
6+
repositories {
7+
// Use the plugin portal to apply community plugins in convention plugins.
8+
gradlePluginPortal()
9+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import org.gradle.api.DefaultTask
2+
import org.gradle.api.tasks.TaskAction
3+
4+
/**
5+
* Converts line endings to CRLF (Windows)
6+
* <p>
7+
* Usage:
8+
* </p>
9+
* <code>
10+
* tasks.register('lineEndingConversion', CRLFConvert) {
11+
* file "path/to/file1.txt"
12+
* file "path/to/fileN.txt"
13+
* }
14+
* </code>
15+
*/
16+
class CRLFConvert extends DefaultTask {
17+
18+
private static final String CRLF = "\r\n"
19+
private static final String LF = "\n"
20+
21+
private files = []
22+
23+
@TaskAction
24+
def action() {
25+
files.each { path ->
26+
File file = new File(path)
27+
if (file.exists()) {
28+
String content = file.text
29+
String newContent = content.replaceAll(/\r\n/, LF)
30+
newContent = newContent.replaceAll(/\n|\r/, CRLF)
31+
if (content != newContent) {
32+
file.write(newContent)
33+
}
34+
} else {
35+
logger.warn('File ' + path + ' does not exist.')
36+
}
37+
}
38+
}
39+
40+
def file(String path) {
41+
this.files << path
42+
}
43+
}

0 commit comments

Comments
 (0)